function twoSum(nums,target) {
    const diff = {};        // es5 没有HashMap O(1)的时间复杂度
    const len = nums.length;//缓存数组的长度
    for(let i = 0;i<len;i++){
        const complement = target - nums[i];//求和问题变成求差问题
        if(diffs[complement])
            return [diffs[complement],i];
    }
    diffs[nums[i]] = i;
}